Click here to return to the VHDL Reference Guide. (last edit: 24. september 2012)

Attribute Name

An attribute gives extra information on specific part of a VHDL description, and can be usation about a specer defined or predefined. User defined attributes are constants, whereas predefined attributes can be constants, functions or signals.

Syntax

  Name[Signature]'AttributeName[(Expression)]

  Signature = [TypeName, ...] return TypeName
    

Where

See Expression

Rules

A procedure, function or enumeration literal must be identified unambiguously by a signature, which identifies the parameter types and return type (to allow for overloading).

Predefined Type Attributes
T is an enumeration, integer, floating or physical type or subtype
T'BASE The base type of T. Only allowed as prefix to another attribute
T'LEFT Left bound of T
T'RIGHT Right bound of T
T'LOW Lower bound of T
T'HIGH Upper bound of T
T'ASCENDING TRUE if range of T is to, FALSE if downto
T'IMAGE(X) The string representation of X in T
T'VALUE(X) The value of type T whose string representation is X
T'POS(X) Position number of X in T
T'VAL(X) Value with position number X in T
T'SUCC(X) Successor = T'VAL(T'POS(X)+1)
T'PRED(X) Predecessor = T'VAL(T'POS(X)-1)
T'LEFTOF(X) Value to the left of X in T
T'RIGHTOF(X) Value to the right of X in T

Predefined Array Attributes
A is an array signal, variable, constant, type or subtype
A'LEFT[(N)] Left bound of Nth index range
A'RIGHT[(N)] Right bound of Nth index range
A'LOW[(N)] Lower bound of Nth index range
A'HIGH[(N)] Upper bound of Nth index range
A'RANGE[(N)] Range of Nth index from left to right
A'REVERSE_RANGE[(N)] Range of Nth index from right to left
A'LENGTH[(N)] The number of values in the Nth index range
A'ASCENDING[(N)] TRUE if Nth index range of A is to, FALSE if downto

Predefined Signal Attributes
S is a signal
S'DELAYED[(T)] A signal with the value that signal S had at time NOW-T
S'STABLE[(T)] A signal which is TRUE if and only if no event has occurred on signal S for time T
S'QUIET[(T)] A signal which is TRUE if and only if no transaction has occurred on S for time T
S'TRANSACTION A signal of type BIT which toggles whenever there is a transaction on S (A signal assignment creates a transaction. A transaction that causes a change in value is an event)
S'EVENT TRUE if and only if there is an event on S in the current delta
S'ACTIVE TRUE if and only if there is a transaction on S in the current delta
S'LAST_EVENT The time since the last event on S
S'LAST_ACTIVE The time since the last transaction on S
S'LAST_VALUE The value of S before the last event
S'DRIVING FALSE if and only if the value of the driver of S in the current process is null
S'DRIVING_VALUE The value of the driver for S in the current process

Predefined General Attributes
E is the name of just about anything!
E'SIMPLE_NAMEThe string representation of the name of E
E'INSTANCE_NAME : The string representation of the hierarchical path name of E, including the names of instantiated entities. Of the form ":ent(arch):componentlabel@ent(arch):componentlabel@ent(arch):thing" or ":lib:pack:thing"
E'PATH_NAME : The string representation of the hierarchical path name of E, excluding the names of instantiated entities. Of the form ":ent:componentlabel:componentlabel:thing" or ":lib:pack:thing"

Things to remember

Type and array attributes have subtly different meanings. T'HIGH gives the maximum value of integer or enumeration type T, but A'HIGH gives the maximum value of the index of array A, not the maximum value that can be stored in A. The attribute S'EVENT is not a signal, so should not be used in a context where a signal is needed to trigger a process. The expression not S'STABLE can be used instead. For example, the following will not work: wait until A'EVENT or B'EVENT; -- waits forever!
Not all predefined attributes are supported by synthesis tools; most tools support 'high, 'low, 'left, 'right, range, 'reverse_range, 'length and 'event. Some also support 'last_value and 'stable.

Synthesis

attributes of enumeration types should not be used for synthesis, nor should the attributes POS, VAL, SUCC, PRED, LEFTOF, RIGHTOF. Many synthesis tools do not support these particular attributes, and attributes of enumeration types can become invalid during optimization.

Tips

Type and array attributes should be used wherever possible to make code easier to read and maintain. The RANGE attribute is particularly useful for looping through arrays.

Example

  type T is (A, B, C, D, E);
  subtype S is T range D downto B;
  S'LEFT = D
  S'RIGHT = B
  S'LOW = B
  S'HIGH = D
  S'BASE'LEFT = A
  T'ASCENDING = TRUE
  S'ASCENDING = FALSE
  T'IMAGE(A) = "a"
  T'VALUE("E") = E
  T'POS(A) = 0
  S'POS(B) = 1
  T'VAL(4) = E
  S'SUCC(B) = C
  S'PRED(C) = B
  S'LEFTOF(B) = C
  S'RIGHTOF(C) = B
  signal A: STD_LOGIC_VECTOR(7 downto 0);
  A'LEFT = 7
  A'RIGHT = 0
  A'LOW = 0
  A'HIGH = 7
  A'RANGE = 7 downto 0
  A'REVERSE_RANGE = 0 to 7
  A'LENGTH = 8
  A'ASCENDING = FALSE
    

See Also

Attribute, Name, Range, Signal